#include <repository/member/member_purchase_record_repository.h>

using namespace model;

// CRUD Operations
insert_ret_type MemberPurchaseRecordRepository::create(
  const MemberPurchaseRecordDTO& member_purchase_record_dto)
{
  return _insert(member_purchase_record_dto);
};

update_ret_type
MemberPurchaseRecordRepository::updateById(const in_id_type id,
                                           const MemberPurchaseRecordDTO& dto)
{
  return _update(dto, db::member_purchase_record{}.id == id);
};

delete_ret_type MemberPurchaseRecordRepository::removeById(const in_id_type id)
{
  return _remove(db::member_purchase_record{}.id == id);
}

// Custom Queries
select_ret_type<MemberPurchaseRecordDTO>
MemberPurchaseRecordRepository::getAll()
{
  return _select(db::member_purchase_record{}.id >= 0);
}

select_ret_type<MemberPurchaseRecordDTO>
MemberPurchaseRecordRepository::getByPage(int page_size, int offset)
{
  return _select_from(db::member_purchase_record{}.id >= 0, page_size, offset);
}

count_type MemberPurchaseRecordRepository::count()
{
  return _countById();
}

// 其他方法实现...
